<template>
	<div>
		<van-nav-bar :title="title" left-text="返回" left-arrow @click-left="$router.back()" @click-right="indexFn" class="back">
			<!-- this.$router.back()  可以实现返回 -->
			<!-- $router.back() 写成 $router.go(-1) 也可以 -->
			<template #right v-if="show">
				<van-icon name="wap-home-o" size="6vw" color="red" />
			</template>
		</van-nav-bar>
	</div>
</template>

<script>
export default {
	props: {
		title: String,
		show: {
			type: Boolean,
			required: true,
		},
	},
	methods: {
		indexFn() {
			if (this.show) this.$emit("right");
		},
	},
};
</script>

<style lang="less" scoped>
/deep/ .van-nav-bar__arrow {
	color: #ccc;
}
/deep/ .van-nav-bar__text {
	color: #ccc;
}
</style>
